package com.ssyt.hiring.web.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ssyt.cdp.common.PageModel;
import com.ssyt.hiring.entity.ApplicationEntity;
import com.ssyt.hiring.entity.CompanyEntity;
import com.ssyt.hiring.entity.PositionEntity;
import com.ssyt.hiring.web.dao.ApplicationDao;
import com.ssyt.hiring.web.dao.CompanyDao;
import com.ssyt.hiring.web.dao.PositionDao;

@Service
public class CompanyService {
	@Autowired
	private CompanyDao companyDao;
	@Autowired
	private PositionDao positionDao;
	@Autowired
	private ApplicationDao applicationDao;

	/**
	 * 公司注册
	 * 
	 * @param company
	 */
	public void companyregister(CompanyEntity company) {
		companyDao.companyregister(company);
	}

	/**
	 * 公司登录
	 * 
	 * @param company
	 * @return
	 */
	public CompanyEntity companyLogin(CompanyEntity company) {
		return companyDao.companyLogin(company);
	}

	/**
	 * 公司信息查询
	 * 
	 * @param companyId
	 * @return
	 */
	public CompanyEntity getInfoCompany(int companyId) {
		return companyDao.getInfoCompany(companyId);
	}

	/**
	 * 企业信息修改
	 * 
	 * @param company
	 */
	public void updateInfoCompany(CompanyEntity company) {
		companyDao.updateInfoCompany(company);
	}

	/**
	 * 查询公司发布的所有职位
	 * 
	 * @param companyId
	 * @return
	 */
	public List<PositionEntity> positionList(int companyId) {
		return positionDao.positionList(companyId);
	}

	/**
	 * 查询所有投递的简历
	 * 
	 * @param pageNo
	 * @param pageSize
	 * @return
	 */
	public PageModel<ApplicationEntity> applicationPageModel(int pageNo,
			int pageSize) {
		return applicationDao.applicationPageModel(pageNo, pageSize);

	}

	/**
	 * 检查注册时code是否重复
	 */
	public boolean checkCompanyCode(String code) {
		return companyDao.checkCompanyCode(code);
	}

}
